import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MailLogVO, MailLogForm, MailLogQuery } from '@/api/mail/log/types';

/**
 * 查询邮件日志列表
 * @param query
 * @returns {*}
 */

export const listMailLog = (query?: MailLogQuery): AxiosPromise<MailLogVO[]> => {
  return request({
    url: '/system/mailLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询邮件日志详细
 * @param id
 */
export const getMailLog = (id: string | number): AxiosPromise<MailLogVO> => {
  return request({
    url: '/system/mailLog/' + id,
    method: 'get'
  });
};

/**
 * 新增邮件日志
 * @param data
 */
export const addMailLog = (data: MailLogForm) => {
  return request({
    url: '/system/mailLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改邮件日志
 * @param data
 */
export const updateMailLog = (data: MailLogForm) => {
  return request({
    url: '/system/mailLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除邮件日志
 * @param id
 */
export const delMailLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/mailLog/' + id,
    method: 'delete'
  });
};
